<template>
  <div>
    <div>
      Getter作为函数接收参数
    </div>
    id:<input type="text" v-model.number="idRef">
    <!-- <button @click="handleGetGoods">getGoodsById</button> -->
    <div>商品信息：{{goodRef}}</div>
    <div>商品信息-自动获取：{{getGoodsById(idRef as number)}}</div>
  </div>
</template>
<script setup lang="ts">
import {useCounterStore} from '@/stores/counter'
import {storeToRefs} from 'pinia'
import {ref} from 'vue'
const counterStore = useCounterStore()
const {getGoodsById} = storeToRefs(counterStore)
const idRef = ref<number>()
const goodRef = ref()
// function handleGetGoods(){
//   if(idRef.value){
//     goodRef.value = getGoodsById(idRef.value as number)
//   }
// }
</script>